$(function(){
	var mySwiper = new Swiper('.swiper-container', {
	    pagination: '.swiper-pagination',
	    paginationClickable: true,
	    direction: 'vertical',
	    //滚轮控制
	    mousewheelControl : true,
		onSlideChangeEnd: function(swiper){
	    	//切换结束时，告诉我现在是第几个slide
			swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
	    	$("#example-navbar-collapse li").eq(swiper.activeIndex).addClass("active").siblings().removeClass("active");
	    },
	    onInit: function(swiper){ //Swiper2.x的初始化是onFirstInit
			swiperAnimateCache(swiper); //隐藏动画元素 
			swiperAnimate(swiper); //初始化完成开始动画
		}
	});

	$('#example-navbar-collapse li').click(function(){
		var index=$('#example-navbar-collapse li').index(this);
		mySwiper.slideTo(index, 1000, false);
		$(this).addClass("active").siblings().removeClass("active");
	})
	// 分页样式自适应
	function setBoxSize(){
		var windowHeight=parseInt($("html").css('height'));
		var paginationHeight=parseInt($("#main_pagination .swiper-pagination").css('height'));
		$("#main_pagination .swiper-pagination").css("top",-(windowHeight/2+paginationHeight/2)+"px");
	}
	setBoxSize();
	$(window).resize(function(){
	   setBoxSize();
	});
})